import 'package:flutter/material.dart';
import 'package:s_mankey/config/net/smonkey_ui_api.dart';
import 'package:s_mankey/config/resource_mananger.dart';
import 'package:s_mankey/config/router_config.dart';
import 'package:s_mankey/generated/I18n.dart';
import 'package:s_mankey/ui/page/MyWidget/user_avatarInfo.dart';
import 'package:s_mankey/ui/widget/custom_list_cell.dart';

class UserPage extends StatefulWidget {
  @override
  _UserPage createState() => _UserPage();
}

class _UserPage extends State<UserPage> with AutomaticKeepAliveClientMixin{

  @override
  bool get wantKeepAlive => true;


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.grey[200],
      body: Column(
        children: <Widget>[
          UserAvatarInfo(),
          Expanded(
            child: _setAvatarInfo(context),
          ),
        ],
      ),
    );
  }

}

/// 用户分类信息
Widget _setAvatarInfo(BuildContext context) {
  List<Map<String, dynamic>> list = [
//    {"title": '学习里程', 'icon': Icon(Icons.book, color: Colors.blue,),"root": RouterName.waller},
    {"title": '盛点支持', 'icon': Icon(Icons.indeterminate_check_box, color: Colors.deepOrange,),"root": RouterName.chooseSource},
    {"title": '我的彩析', 'icon': Icon(Icons.video_call, color: Colors.pinkAccent,),"root": RouterName.myVideos},
    {"title": '系统消息', 'icon': Icon(Icons.mail, color: Colors.yellow,),"root": RouterName.systemNotice},
  ];
  return Container(
      color: Colors.white,
      margin: EdgeInsets.only(top: 10),
      child: Column(
        children: <Widget>[
          MediaQuery.removePadding(
            removeTop: true,
            context: context,
            child:
            ListView.builder(
              primary: true,
              shrinkWrap: true,
              physics: NeverScrollableScrollPhysics(),
              itemCount: list.length,
              itemBuilder: (BuildContext context, int index) {
                return CustomListViewCell(
                  rootString: list[index]['root'],
                  index: index,
                  leading: list[index]['icon'],
                  title: list[index]['title'],
                  subTitle: '',
                  trailing: IconFonts.rightIcon);
              },
            ),
          ),
          Container(
            color: Colors.white,
          ),
        ],
      ));
}


